<template>
  <dict-basic-form
    :mode="mode"
    :code="code"
    :titleAdd="'添加设备类型'"
    :titleEdit="'编辑设备类型'"
    :nameLabel="'设备类型'"
    :showColor="false"
    :api="dictApi"
    :extendInit="{ category: null }"
    :extraRules="{ category: [{ required: true, message: '请选择分类', trigger: 'change' }] }"
    :disable-enabled="disableEnabled"
    @success="$emit('success')"
    @close="$emit('close')"
  >
    <template #extra="{ form }">
      <el-form-item label="分类" prop="category">
        <el-select v-model="form.category" placeholder="请选择" :filterable="false" style="width: 100%">
          <el-option label="备件" value="备件" />
          <el-option label="资产" value="资产" />
        </el-select>
      </el-form-item>
    </template>
  </dict-basic-form>
  
</template>

<script>
import DictBasicForm from '@/views/components/DictBasicForm.vue'
import { getDeviceType, addDeviceType, updateDeviceType } from '@/api/dict/deviceType'

export default {
  name: 'DeviceTypeForm',
  components: { DictBasicForm },
  props: {
    mode: String,
    code: String,
    disableEnabled: { type: Boolean, default: false }
  },
  computed: {
    dictApi() {
      return { get: getDeviceType, add: addDeviceType, update: updateDeviceType }
    }
  }
}
</script>

 


